home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / JComponent$AccessibleJComponent.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  6.8 KB  |  273 lines

  1. package javax.swing;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Container;
  5. import java.awt.Cursor;
  6. import java.awt.Dimension;
  7. import java.awt.Font;
  8. import java.awt.FontMetrics;
  9. import java.awt.Point;
  10. import java.awt.Rectangle;
  11. import java.awt.event.ContainerListener;
  12. import java.awt.event.FocusListener;
  13. import java.awt.event.MouseEvent;
  14. import java.beans.PropertyChangeListener;
  15. import java.io.Serializable;
  16. import java.util.Locale;
  17. import javax.accessibility.Accessible;
  18. import javax.accessibility.AccessibleComponent;
  19. import javax.accessibility.AccessibleContext;
  20. import javax.accessibility.AccessibleRole;
  21. import javax.accessibility.AccessibleState;
  22. import javax.accessibility.AccessibleStateSet;
  23. import javax.swing.border.Border;
  24. import javax.swing.border.CompoundBorder;
  25. import javax.swing.border.TitledBorder;
  26.  
  27. public abstract class JComponent$AccessibleJComponent extends AccessibleContext implements Serializable, AccessibleComponent {
  28.    // $FF: synthetic field
  29.    private final JComponent this$0;
  30.    protected ContainerListener accessibleContainerHandler;
  31.  
  32.    protected JComponent$AccessibleJComponent(JComponent var1) {
  33.       this.this$0 = var1;
  34.       this.accessibleContainerHandler = null;
  35.    }
  36.  
  37.    public void addFocusListener(FocusListener var1) {
  38.       this.this$0.addFocusListener(var1);
  39.    }
  40.  
  41.    public void addPropertyChangeListener(PropertyChangeListener var1) {
  42.       if (this.accessibleContainerHandler == null) {
  43.          this.accessibleContainerHandler = new JComponent.AccessibleJComponent.AccessibleContainerHandler(this);
  44.          this.this$0.addContainerListener(this.accessibleContainerHandler);
  45.       }
  46.  
  47.       super.addPropertyChangeListener(var1);
  48.    }
  49.  
  50.    public boolean contains(Point var1) {
  51.       return this.this$0.contains(var1);
  52.    }
  53.  
  54.    public Accessible getAccessibleAt(Point var1) {
  55.       return SwingUtilities.getAccessibleAt(this.this$0, var1);
  56.    }
  57.  
  58.    public Accessible getAccessibleChild(int var1) {
  59.       return this.this$0.ui != null ? this.this$0.ui.getAccessibleChild(this.this$0, var1) : SwingUtilities.getAccessibleChild(this.this$0, var1);
  60.    }
  61.  
  62.    public int getAccessibleChildrenCount() {
  63.       return this.this$0.ui != null ? this.this$0.ui.getAccessibleChildrenCount(this.this$0) : SwingUtilities.getAccessibleChildrenCount(this.this$0);
  64.    }
  65.  
  66.    public AccessibleComponent getAccessibleComponent() {
  67.       return this;
  68.    }
  69.  
  70.    public String getAccessibleDescription() {
  71.       String var1 = super.accessibleDescription;
  72.       if (var1 == null) {
  73.          try {
  74.             var1 = this.this$0.getToolTipText((MouseEvent)null);
  75.          } catch (Exception var4) {
  76.          }
  77.       }
  78.  
  79.       if (var1 == null) {
  80.          Object var2 = this.this$0.getClientProperty("labeledBy");
  81.          if (var2 instanceof Accessible) {
  82.             AccessibleContext var3 = ((Accessible)var2).getAccessibleContext();
  83.             if (var3 != null) {
  84.                var1 = var3.getAccessibleDescription();
  85.             }
  86.          }
  87.       }
  88.  
  89.       return var1;
  90.    }
  91.  
  92.    public int getAccessibleIndexInParent() {
  93.       return SwingUtilities.getAccessibleIndexInParent(this.this$0);
  94.    }
  95.  
  96.    public String getAccessibleName() {
  97.       String var1 = super.accessibleName;
  98.       if (var1 == null) {
  99.          var1 = this.getBorderTitle(this.this$0.getBorder());
  100.       }
  101.  
  102.       if (var1 == null) {
  103.          Object var2 = this.this$0.getClientProperty("labeledBy");
  104.          if (var2 instanceof Accessible) {
  105.             AccessibleContext var3 = ((Accessible)var2).getAccessibleContext();
  106.             if (var3 != null) {
  107.                var1 = var3.getAccessibleName();
  108.             }
  109.          }
  110.       }
  111.  
  112.       return var1;
  113.    }
  114.  
  115.    public Accessible getAccessibleParent() {
  116.       if (super.accessibleParent != null) {
  117.          return super.accessibleParent;
  118.       } else {
  119.          Container var1 = this.this$0.getParent();
  120.          return var1 instanceof Accessible ? (Accessible)var1 : null;
  121.       }
  122.    }
  123.  
  124.    public AccessibleRole getAccessibleRole() {
  125.       return AccessibleRole.SWING_COMPONENT;
  126.    }
  127.  
  128.    public AccessibleStateSet getAccessibleStateSet() {
  129.       return SwingUtilities.getAccessibleStateSet(this.this$0);
  130.    }
  131.  
  132.    public Color getBackground() {
  133.       return this.this$0.getBackground();
  134.    }
  135.  
  136.    protected String getBorderTitle(Border var1) {
  137.       if (var1 instanceof TitledBorder) {
  138.          return ((TitledBorder)var1).getTitle();
  139.       } else if (var1 instanceof CompoundBorder) {
  140.          String var2 = this.getBorderTitle(((CompoundBorder)var1).getInsideBorder());
  141.          if (var2 == null) {
  142.             var2 = this.getBorderTitle(((CompoundBorder)var1).getOutsideBorder());
  143.          }
  144.  
  145.          return var2;
  146.       } else {
  147.          return null;
  148.       }
  149.    }
  150.  
  151.    public Rectangle getBounds() {
  152.       return this.this$0.getBounds();
  153.    }
  154.  
  155.    public Cursor getCursor() {
  156.       return this.this$0.getCursor();
  157.    }
  158.  
  159.    public Font getFont() {
  160.       return this.this$0.getFont();
  161.    }
  162.  
  163.    public FontMetrics getFontMetrics(Font var1) {
  164.       return this.this$0.getFontMetrics(var1);
  165.    }
  166.  
  167.    public Color getForeground() {
  168.       return this.this$0.getForeground();
  169.    }
  170.  
  171.    public Locale getLocale() {
  172.       return this.this$0.getLocale();
  173.    }
  174.  
  175.    public Point getLocation() {
  176.       return this.this$0.getLocation();
  177.    }
  178.  
  179.    public Point getLocationOnScreen() {
  180.       return this.this$0.isShowing() ? this.this$0.getLocationOnScreen() : null;
  181.    }
  182.  
  183.    public Dimension getSize() {
  184.       return this.this$0.getSize();
  185.    }
  186.  
  187.    public boolean isEnabled() {
  188.       return this.this$0.isEnabled();
  189.    }
  190.  
  191.    public boolean isFocusTraversable() {
  192.       return this.this$0.isFocusTraversable();
  193.    }
  194.  
  195.    public boolean isShowing() {
  196.       return this.this$0.isShowing();
  197.    }
  198.  
  199.    public boolean isVisible() {
  200.       return this.this$0.isVisible();
  201.    }
  202.  
  203.    public void removeFocusListener(FocusListener var1) {
  204.       this.this$0.removeFocusListener(var1);
  205.    }
  206.  
  207.    public void removePropertyChangeListener(PropertyChangeListener var1) {
  208.       if (this.accessibleContainerHandler == null) {
  209.          this.this$0.removeContainerListener(this.accessibleContainerHandler);
  210.       }
  211.  
  212.       super.removePropertyChangeListener(var1);
  213.    }
  214.  
  215.    public void requestFocus() {
  216.       this.this$0.requestFocus();
  217.    }
  218.  
  219.    public void setBackground(Color var1) {
  220.       this.this$0.setBackground(var1);
  221.    }
  222.  
  223.    public void setBounds(Rectangle var1) {
  224.       this.this$0.setBounds(var1);
  225.    }
  226.  
  227.    public void setCursor(Cursor var1) {
  228.       this.this$0.setCursor(var1);
  229.    }
  230.  
  231.    public void setEnabled(boolean var1) {
  232.       boolean var2 = this.this$0.isEnabled();
  233.       this.this$0.setEnabled(var1);
  234.       if (var1 != var2 && this.this$0.accessibleContext != null) {
  235.          if (var1) {
  236.             this.this$0.accessibleContext.firePropertyChange("AccessibleState", (Object)null, AccessibleState.ENABLED);
  237.          } else {
  238.             this.this$0.accessibleContext.firePropertyChange("AccessibleState", AccessibleState.ENABLED, (Object)null);
  239.          }
  240.       }
  241.  
  242.    }
  243.  
  244.    public void setFont(Font var1) {
  245.       this.this$0.setFont(var1);
  246.    }
  247.  
  248.    public void setForeground(Color var1) {
  249.       this.this$0.setForeground(var1);
  250.    }
  251.  
  252.    public void setLocation(Point var1) {
  253.       this.this$0.setLocation(var1);
  254.    }
  255.  
  256.    public void setSize(Dimension var1) {
  257.       this.this$0.setSize(var1);
  258.    }
  259.  
  260.    public void setVisible(boolean var1) {
  261.       boolean var2 = this.this$0.isVisible();
  262.       this.this$0.setVisible(var1);
  263.       if (var1 != var2 && this.this$0.accessibleContext != null) {
  264.          if (var1) {
  265.             this.this$0.accessibleContext.firePropertyChange("AccessibleState", (Object)null, AccessibleState.VISIBLE);
  266.          } else {
  267.             this.this$0.accessibleContext.firePropertyChange("AccessibleState", AccessibleState.VISIBLE, (Object)null);
  268.          }
  269.       }
  270.  
  271.    }
  272. }
  273.